import { Length, IsNotEmpty, IsNumber } from "class-validator";
import BaseEntity from "./BaseEntity";
import { ExtData, Photos } from "./CustomTransform";
import { Transform, Type } from "class-transformer";

export class MarkerPoiEntity extends BaseEntity {
  @IsNumber()
  @IsNotEmpty()
  @Type(() => Number)
  u_id: number;

  @Type(() => Number)
  m_id: number;

  @IsNotEmpty()
  id: string;

  @Length(1, 30)
  address: string;

  @IsNotEmpty()
  @Type(() => Number)
  longitude: number;

  @IsNotEmpty()
  @Type(() => Number)
  latitude: number;

  @Length(1, 8)
  @IsNotEmpty()
  citycode: string;

  @Length(1, 20)
  @IsNotEmpty()
  cityname: string;

  @IsNotEmpty()
  @Length(1, 10)
  pname: string;

  postcode: string;

  @IsNotEmpty()
  @Length(1, 6)
  pcode: string;

  @IsNotEmpty()
  @Length(1, 30)
  adname: string;

  @IsNotEmpty()
  @Length(1, 6)
  adcode: string;

  @Transform(Photos)
  photos: string | object;

  @Type(() => Number)
  is_open: boolean; // 1: 公开，0: 仅自己可见

  @Transform(ExtData)
  extdata: string | object;
}
